home *** CD-ROM | disk | FTP | other *** search
/ Aminet 2 / Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso / Aminet / dev / misc / sana2.lzh / sana2 / include / devices / sana2.h next >
C/C++ Source or Header  |  1991-11-18  |  7KB  |  253 lines

  1. #ifndef SANA2_SANA2DEVICE_H
  2. #define SANA2_SANA2DEVICE_H 1
  3. /*
  4. **    $Id: sana2.h,v 1.4 91/11/07 11:34:41 dlarson Exp $
  5. **
  6. **    Structure definitions for SANA-II devices.
  7. **
  8. **    (C) Copyright 1991 Commodore-Amiga Inc.
  9. **        All Rights Reserved
  10. */
  11.  
  12.  
  13. #ifndef EXEC_TYPES_H
  14. #include <exec/types.h>
  15. #endif
  16.  
  17. #ifndef EXEC_PORTS_H
  18. #include <exec/ports.h>
  19. #endif
  20.  
  21. #ifndef EXEC_IO_H
  22. #include <exec/io.h>
  23. #endif
  24.  
  25. #ifndef EXEC_ERRORS_H
  26. #include <exec/errors.h>
  27. #endif
  28.  
  29. #ifndef DEVICES_TIMER_H
  30. #include <devices/timer.h>
  31. #endif
  32.  
  33. #ifndef UTILITY_TAGITEM_H
  34. #include <utility/tagitem.h>
  35. #endif
  36.  
  37.  
  38. #define SANA2_MAX_ADDR_BITS    (128)
  39. #define SANA2_MAX_ADDR_BYTES    ((SANA2_MAX_ADDR_BITS+7)/8)
  40.  
  41. struct IOSana2Req
  42. {
  43.     struct IORequest ios2_Req;
  44.     ULONG ios2_WireError;        /* wire type specific error    */
  45.     ULONG ios2_PacketType;        /* packet type            */
  46.     UBYTE ios2_SrcAddr[SANA2_MAX_ADDR_BYTES];    /* source addr    */
  47.     UBYTE ios2_DstAddr[SANA2_MAX_ADDR_BYTES];    /* dest address    */
  48.     ULONG ios2_DataLength;        /* length of packet data    */
  49.     VOID *ios2_Data;        /* packet data            */
  50.     VOID *ios2_StatData;        /* statics data pointer        */
  51.     VOID *ios2_BufferManagement;    /* see SANA-II OpenDevice adoc    */
  52. };
  53.  
  54.  
  55. /*
  56. ** defines for the ios2_Flags field
  57. */
  58. #define SANA2IOB_RAW    (7)        /* raw packet IO requested    */
  59. #define SANA2IOF_RAW    (1<<SANA2IOB_RAW)
  60.  
  61. #define    SANA2IOB_BCAST    (6)        /* broadcast packet (received)    */
  62. #define    SANA2IOF_BCAST    (1<<SANA2IOB_BCAST)
  63.  
  64. #define    SANA2IOB_MCAST    (5)        /* multicast packet (received)    */
  65. #define    SANA2IOF_MCAST    (1<<SANA2IOB_MCAST)
  66.  
  67. #define SANA2IOB_QUICK    (IOB_QUICK)    /* quick IO requested (0)    */
  68. #define SANA2IOF_QUICK    (IOF_QUICK)
  69.  
  70.  
  71. /*
  72. ** defines for OpenDevice() flags
  73. */
  74. #define SANA2OPB_MINE    (0)        /* exclusive access requested    */
  75. #define SANA2OPF_MINE    (1<<SANA2OPB_MINE)
  76.  
  77. #define SANA2OPB_PROM    (1)        /* promiscuous mode requested    */
  78. #define SANA2OPF_PROM    (1<<SANA2OPB_PROM)
  79.  
  80.  
  81. /*
  82. ** defines for OpenDevice() tags
  83. */
  84. #define S2_Dummy    (TAG_USER + 0xB0000)
  85.  
  86. #define S2_CopyToBuff    (S2_Dummy + 1)
  87. #define S2_CopyFromBuff    (S2_Dummy + 2)
  88.  
  89.  
  90. struct Sana2DeviceQuery
  91. {
  92. /*
  93. ** Standard information
  94. */
  95.     ULONG    SizeAvailable;        /* bytes available        */
  96.     ULONG    SizeSupplied;        /* bytes supplied        */
  97.     ULONG    DevQueryFormat;        /* this is type 0        */
  98.     ULONG    DeviceLevel;        /* this document is level 0    */
  99. /*
  100. ** Common information
  101. */
  102.     UWORD    AddrFieldSize;        /* address size in bits        */
  103.     ULONG    MTU;            /* maximum packet data size    */
  104.     ULONG    BPS;            /* line rate (bits/sec)        */
  105.     ULONG    HardwareType;        /* what the wire is        */
  106. /*
  107. ** Format specific information
  108. */
  109. };
  110.  
  111.  
  112. /*
  113. ** defined Hardware types
  114. **
  115. **  If your hardware type isn't listed below contact CATS to get a new
  116. **  type number added for your hardware.
  117. */
  118.  
  119. #define S2WireType_Ethernet        1
  120. #define S2WireType_IEEE802        6
  121. #define S2WireType_Arcnet        7
  122. #define S2WireType_LocalTalk        11
  123.  
  124. #define S2WireType_PPP            253
  125. #define S2WireType_SLIP            254
  126. #define S2WireType_CSLIP        255
  127.  
  128.  
  129. struct Sana2PacketTypeStats
  130. {
  131.     ULONG PacketsSent;        /* transmitted count        */
  132.     ULONG PacketsReceived;        /* received count        */
  133.     ULONG BytesSent;        /* bytes transmitted count    */
  134.     ULONG BytesReceived;        /* bytes received count        */
  135.     ULONG PacketsDropped;        /* packets dropped count    */
  136. };
  137.  
  138.  
  139. struct Sana2SpecialStatRecord
  140. {
  141.     ULONG Type;            /* statistic identifier        */
  142.     ULONG Count;            /* the statistic        */
  143.     char *String;            /* statistic name        */
  144. };
  145.  
  146.  
  147. struct Sana2SpecialStatHeader
  148. {
  149.     ULONG RecordCountMax;        /* room available        */
  150.     ULONG RecordCountSupplied;    /* number supplied        */
  151.     /* struct Sana2SpecialStatRecord[RecordCountMax]; */
  152. };
  153.  
  154.  
  155. struct Sana2DeviceStats
  156. {
  157.     ULONG PacketsReceived;        /* received count        */
  158.     ULONG PacketsSent;        /* transmitted count        */
  159.     ULONG BadData;            /* bad packets received        */
  160.     ULONG Overruns;            /* hardware miss count        */
  161.     ULONG UnknownTypesReceived;    /* orphan count            */
  162.     ULONG Reconfigurations;        /* network reconfigurations    */
  163.     struct timeval LastStart;    /* time of last online        */
  164. };
  165.  
  166.  
  167. /*
  168. ** Device Commands
  169. */
  170. #define S2_START        (CMD_NONSTD)
  171.  
  172. #define S2_DEVICEQUERY        (S2_START+ 0)
  173. #define S2_GETSTATIONADDRESS    (S2_START+ 1)
  174. #define S2_CONFIGINTERFACE    (S2_START+ 2)
  175. #define S2_ADDSTATIONALIAS    (S2_START+ 3)
  176. #define S2_DELSTATIONALIAS    (S2_START+ 4)
  177. #define S2_ADDMULTICASTADDRESS    (S2_START+ 5)
  178. #define S2_DELMULTICASTADDRESS    (S2_START+ 6)
  179. #define S2_MULTICAST        (S2_START+ 7)
  180. #define S2_BROADCAST        (S2_START+ 8)
  181. #define S2_TRACKTYPE        (S2_START+ 9)
  182. #define S2_UNTRACKTYPE        (S2_START+10)
  183. #define S2_GETTYPESTATS        (S2_START+11)
  184. #define S2_GETSPECIALSTATS    (S2_START+12)
  185. #define S2_GETGLOBALSTATS    (S2_START+13)
  186. #define S2_ONEVENT        (S2_START+14)
  187. #define S2_READORPHAN        (S2_START+15)
  188. #define S2_ONLINE        (S2_START+16)
  189. #define S2_OFFLINE        (S2_START+17)
  190.  
  191. #define S2_END            (S2_START+18)
  192.  
  193.  
  194. /*
  195. ** defined errors for ios2_Error  (see also <exec/errors.h>)
  196. */
  197. #define S2ERR_NO_ERROR        0    /* peachy-keen            */
  198. #define S2ERR_NO_RESOURCES    1    /* resource allocation failure    */
  199. #define S2ERR_BAD_ARGUMENT    3    /* garbage somewhere        */
  200. #define S2ERR_BAD_STATE        4    /* inappropriate state        */
  201. #define S2ERR_BAD_ADDRESS    5    /* who?                */
  202. #define    S2ERR_MTU_EXCEEDED    6    /* too much to chew        */
  203. #define S2ERR_NOT_SUPPORTED    8    /* hardware can't support cmd    */
  204. #define S2ERR_SOFTWARE        9    /* software error detected    */
  205. #define S2ERR_OUTOFSERVICE    10    /* driver is OFFLINE        */
  206. /*
  207. ** From <exec/errors.h>
  208. **
  209. **    IOERR_OPENFAIL     (-1) * device/unit failed to open *
  210. **    IOERR_ABORTED     (-2) * request terminated early [after AbortIO()] *
  211. **    IOERR_NOCMD     (-3) * command not supported by device *
  212. **    IOERR_BADLENGTH     (-4) * not a valid length (usually IO_LENGTH) *
  213. **    IOERR_BADADDRESS (-5) * invalid address (misaligned or bad range) *
  214. **    IOERR_UNITBUSY     (-6) * device opens ok, but requested unit is busy *
  215. **    IOERR_SELFTEST   (-7) * hardware failed self-test *
  216. */
  217.  
  218. /*
  219. ** defined errors for ios2_WireError
  220. */
  221. #define S2WERR_GENERIC_ERROR    0    /* no specific info available    */
  222. #define    S2WERR_NOT_CONFIGURED    1    /* unit not configured        */
  223. #define S2WERR_UNIT_ONLINE    2    /* unit is currently online    */
  224. #define S2WERR_UNIT_OFFLINE    3    /* unit is currently offline    */
  225. #define    S2WERR_ALREADY_TRACKED    4    /* protocol already tracked    */
  226. #define    S2WERR_NOT_TRACKED    5    /* protocol not tracked        */
  227. #define S2WERR_BUFF_ERROR    6    /* buff mgt func returned error    */
  228. #define S2WERR_SRC_ADDRESS    7    /* source address problem    */
  229. #define S2WERR_DST_ADDRESS    8    /* destination address problem    */
  230. #define S2WERR_BAD_BROADCAST    9    /* broadcast address problem    */
  231. #define S2WERR_BAD_MULTICAST    10    /* multicast address problem    */
  232. #define S2WERR_MULTICAST_FULL    11    /* multicast address list full    */
  233. #define S2WERR_BAD_EVENT    12    /* unsupported event class      */
  234. #define S2WERR_BAD_STATDATA    13    /* statdata failed sanity check */
  235. #define S2WERR_IS_CONFIGURED    15    /* attempt to config twice      */
  236. #define S2WERR_NULL_POINTER    16    /* null pointer detected        */
  237.  
  238.  
  239. /*
  240. ** defined events
  241. */
  242. #define    S2EVENT_ERROR        (1L<<0)    /* error catch all        */
  243. #define    S2EVENT_TX        (1L<<1)    /* transmitter error catch all    */
  244. #define    S2EVENT_RX        (1L<<2)    /* receiver error catch all    */
  245. #define    S2EVENT_ONLINE        (1L<<3)    /* unit is in service        */
  246. #define    S2EVENT_OFFLINE        (1L<<4)    /* unit is not in service    */
  247. #define    S2EVENT_BUFF        (1L<<5)    /* buff mgt function error    */
  248. #define S2EVENT_HARDWARE    (1L<<6)    /* hardware error catch all    */
  249. #define S2EVENT_SOFTWARE    (1L<<7)    /* software error catch all    */
  250.  
  251.  
  252. #endif    /* SANA2_SANA2DEVICE_H */
  253.